#! /bin/env python
#-*- coding:utf-8 -*-

import getopt, sys

def usage():
    print sys.argv[0], "[-h|--help] [-o|--output= <file>] [-v]"

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
    except getopt.GetoptError as err:
        print str(err)
        usage()
        sys.exit(2)

    output = None
    verbose = False

    for o, a in opts:
        if o == "-v":
            verbose = True
        elif o in ("-h", "--help"):
            usage()
            sys.exit(0)
        elif o in ("-o", "--output"):
            output = a
        else:
            assert False, "unhandled option"

    print "output=", output
    print "verbose=", verbose

if __name__ == "__main__":
    main()

